<?php
/**
 * 小微商户
 */
namespace app\allwin\validate;
use think\Validate;

class MchId extends Validate{

    protected $rule = [
        'mchid'              => 'require|integer|length: 6,18',
        'province'           => 'require',
        'city'               => 'require',
        'district'           => 'require',
        'store_name'         => 'require',
        'merchant_shortname' => 'require',
        'store_street'       => 'require',
        'store_entrance_pic' => 'require',
        'indoor_pic'         => 'require',
        'contact_phone'      => 'require|mobile',
        'product_desc'       => 'require',
        'id_card_name'       => 'require',
        'id_card_number'     => 'require|idCard',
        'id_card_copy'       => 'require',
        'id_card_national'   => 'require',
        'account_bank'       => 'require',
        'account_number'     => 'require|number',
        'bank_address_code'  => 'require|number|length:6',
    ];

    protected $message = [
        'mchid'              => '商户ID必须填写(6-18位)',
        'province'           => '省份必须选择',
        'city'               => '城市必须选择',
        'district'           => '市/县/区必须选择',
        'store_name'         => '门店名称不能为空',
        'merchant_shortname' => '商户简称不能为空',
        'store_street'       => '详细地址不能为空',
        'store_entrance_pic' => '门店门口照片不能为空',
        'indoor_pic'         => '店内环境照片不能为空',
        'contact_phone'      => '手机号为空或格式错误',
        'product_desc'       => '提供服务描述比较填写',
        'id_card_name'       => '身份证姓名必须填写',
        'id_card_number'     => '身份证号码必须填写',
        'id_card_copy'       => '身份证证明必须上传',
        'id_card_national'   => '身份证背面必须填写',
        'account_bank'       => '开户银行必须选择',
        'account_number'     => '收款银行卡号必须填写',
        'bank_address_code'  => '开户地城市必须添加',
    ];

    protected $scene = [
        'edit'         => ['mchid','merchant_shortname','store_name','contact_phone','store_street'], //商家管理
        'address_code' => ['province','city','district'], //商家管理
        'reg'          => ['store_name','merchant_shortname','store_street','store_entrance_pic','indoor_pic','contact_phone','product_desc','id_card_name','id_card_number','id_card_copy','id_card_national','account_bank','account_number','bank_address_code'],  //开通小微商户
        'pass'         => ['store_name','merchant_shortname','store_street','contact_phone','product_desc','id_card_name','id_card_number','account_bank','account_number','bank_address_code']  //开通小微商户    
    ];
}